 <%@page import="edu.uit.se.laps.web.model.TaiKhoan"%>
<%@page import="edu.uit.se.laps.web.model.SanPham"%>
<%@page import="edu.uit.se.laps.web.model.LoaiSanPham"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!-- pageEncoding="UTF-8"%> -->
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ page
	import="edu.uit.se.laps.web.*,edu.uit.se.laps.web.controller.*, java.net.*,java.text.*,java.util.*"%>

<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body,input {
	font-family: Calibri, Arial;
}

table#contact {
	border-collapse: collapse;
	width: 550px;
}

table{
	margin: 30px 30px;
}
table td{
	border:1px solid black;
}
th {
	background-color: #ffee55;
}
.khungaddSP {
	width: 100%;
	background: #FFFFEB;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	-ms-border-radius: 10px;
	-o-border-radius: 10px;
	border-radius: 10px;
	box-shadow: 0px 0px 25px #808076;
}
.addsp {
	padding-top: 50px;
	padding-bottom: 100px;
}

h1{
	color: red;
	padding-top: 20px;
	margin-left: 20px;
}
ul{
	list-style-type: none;
}
ul a{
	width: 160px;
	display: inline-block;
}
textarea{
	max-width: 500px;
	width: 300px;
	height: 60px;
}

.taotk{
	background: red;
	height: 40px;
	color: white;
	font-size: 18px;
	cursor: pointer;
	border: none;	
	margin: 20px 20px;
}

.taotk:hover{
	background: #8F2400;
}
</style>
<title>myLife - Quản Lý Loại Sản Phẩm</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script language="javascript" src="1.7.2.jquery.min.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
		$('.tb_donhang').css({'margin':'50px 0px'});
		
		$('table').css({'border-collapse':'collapse', 'margin-bottom':'30px'});
		$('table td').css({'border':'1px solid black', 'padding':'4px'});
		$('table th').css({'border':'2px solid green','padding':'4px'});
		$('.themSP').css({'float':'left', 'height':'30px', 'background':'#B20000', 'margin-left':'30px'});
		$('.themSP a').css({'text-decoration':'none', 'padding':'0px 4px', 'color':'white', 
			'line-height':'30px'});
	});
</script>

</head>
<body>
	<tiles:insertTemplate template="TemAdmin.jsp">
		<tiles:putAttribute name="adminFocus">
	<div class="addsp" align="left">
				<div class="khungaddSP">
	<%
		ShoppingCart cart = (ShoppingCart) session
				.getAttribute("ShoppingCart");
		if (cart == null) {
			cart = new ShoppingCart();
			session.setAttribute("ShoppingCart", cart);
		}
		List loaiSPList = cart.getLoaiSP();
		
		TaiKhoanSession tkSession = (TaiKhoanSession) session.getAttribute("TaiKhoanSession");
		if (tkSession == null) {
			tkSession = new TaiKhoanSession();
			session.setAttribute("TaiKhoanSession", tkSession);
		}
		TaiKhoan tk = tkSession.getTk();
		
		if (loaiSPList.size() != 0) {
	%>

	<h1>DANH SÁCH LOẠI SẢN PHẨM</h1>

	<div  class="themSP"><a href="addloaisp.jsp">Thêm loại sản phẩm</a></div><br><br>


	<script src="paypal-button.min.js?merchant=marsnho@gmail.com"
		data-button="buynow" data-name="Váy hoa" data-quantity="1"
		data-amount="5" data-currency="USD" data-shipping="0.75"
		data-callback="http://www.google.com" data-env="sandbox"></script>


	<table id="sp" >
		<tr>
			<th>Id loại Sản phẩm</th>
			<th>Tên loại sản phẩm</th>
			
			<th>Chỉnh sửa</th>
			
			<%
				
				for (int i = 0; i < loaiSPList.size(); i++) {
					LoaiSanPham loaiSp = (LoaiSanPham) loaiSPList.get(i);
				
			%>
		</tr>
		
			<tr>				
				<td><%= loaiSp.getIdLoaiSP() %></td>
				<td><%= loaiSp.getTenLoaiSP() %></td>

				<td>
				<s:form action="showUpdateLoaiSP" method="post">
				<input type="hidden" name="idLoaiSP" value='<%=loaiSp.getIdLoaiSP()%>'/>
				<input type="submit" value="Cập nhật"/>
				</s:form>				
				</td>
								
				 
			</tr>
		<%
				}
		%>
	</table>
	
	<%
		}
	%>
	
	<br><br>
	</div>
	</div>
	</tiles:putAttribute>
	</tiles:insertTemplate>
</body>
</html>